package com.finace.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {

	public Properties DbProperties() throws IOException {
		Properties pro = new Properties();
		InputStream inStream = PropertiesUtil.class.getClassLoader().getResourceAsStream("db.properties");
		pro.load(inStream);
		return pro;
	}

	public String getUserName() throws IOException {
		return DbProperties().getProperty("username");
	}

	public String getPassword() throws IOException {
		return DbProperties().getProperty("password");
	}

	public String getHost() throws IOException {
		return DbProperties().getProperty("host");
	}

	public String getPort() throws IOException {
		return DbProperties().getProperty("port");
	}

	public static void main(String[] arg) {
		PropertiesUtil pro = new PropertiesUtil();
		try {
			System.out.println(pro.getUserName());
			System.out.println(pro.getPassword());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
